package model

import (
	"time"
	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	Username     string     `gorm:"unique;not null;size:20;comment:用户名" json:"username"`
	Email        string     `gorm:"unique;not null;size:100;comment:邮箱" json:"email"`
	PasswordHash string     `gorm:"not null;size:255;comment:密码哈希" json:"-"`
	Nickname     string     `gorm:"size:50;comment:昵称" json:"nickname"`
	Avatar       string     `gorm:"size:255;comment:头像URL" json:"avatar"`
	Bio          string     `gorm:"size:200;comment:个人简介" json:"bio"`
	Role         string     `gorm:"type:varchar(20);not null;default:'user';comment:角色(admin/user)" json:"role"`
	Status       int        `gorm:"not null;default:1;comment:状态(0:禁用,1:正常)" json:"status"`
	LastLoginAt  *time.Time `gorm:"comment:最后登录时间" json:"last_login_at"`

	CreatedAt    time.Time  `gorm:"comment:创建时间" json:"created_at"`
	UpdatedAt    time.Time  `gorm:"comment:更新时间" json:"updated_at"`
}
